!function(e){"use strict";function t(e){let t=e;t.next().val(""),t.hide().prev().addClass("button").html("Upload image")}e(document).ready(function(){let o=navigator.userAgent.toLowerCase().indexOf("android")>-1,i=0;o&&(i=1/0),e(document).on("click","#show_bottom_widget",function(t){e(this).is(":checked")?(e("#show_open_close_button").parent("label").addClass("wpc-inactive-settings-field"),e(".wpc-bottom-widget-compatibility").addClass("wpc-opened")):(e("#show_open_close_button").parent("label").removeClass("wpc-inactive-settings-field"),e(".wpc-bottom-widget-compatibility").removeClass("wpc-opened"))}),e(document).on("click","#use_color_swatches",function(t){e(this).is(":checked")?e(".wpc-color-swatches-taxonomies").addClass("wpc-opened"):e(".wpc-color-swatches-taxonomies").removeClass("wpc-opened")}),e("#wpc_primary_color").wpColorPicker({defaultColor:"",palettes:["#0570e2","#f44336","#E91E63","#007cba","#65BC7B","#FFEB3B","#FFC107","#FF9800","#607D8B"]}),e("#wpc_term_color").wpColorPicker({defaultColor:"",palettes:["#0000FF","#808080","#008000","#FF0000","#FFFF00","#FFA500","#00bfff","#7F00FF","#FFFFFF"]}),e(".wpc-help-tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200,keepAlive:!0,maxWidth:"220px"}),e(".wpc-sortable-table").sortable({items:"tr.pro-version.wpc-sortable-row",delay:150,placeholder:"wpc-filter-field-shadow",refreshPositions:!0,cursor:"move",handle:".wpc-order-sortable-handle-icon",axis:"y",update:function(t,o){let i;i=0,e("tr.wpc-sortable-row").each(function(t,o){i=t+1,e(o).find(".wpc-order-td").text(i)})}}),e(document).on("click",".free-version .wpc-field-sortable-handle",function(){alert(wpcFiltersAdminCommon.prefixesOrderAvailableInPro)}),e("#show_terms_in_content").select2({width:"80%",placeholder:wpcFiltersAdminCommon.chipsPlaceholder,minimumResultsForSearch:i,tags:!0}),e("#color_swatches_taxonomies").select2({width:"80%",placeholder:wpcFiltersAdminCommon.colorSwatchesPlaceholder,minimumResultsForSearch:i,tags:!1}),e("body").on("click",".wpc-notice-dismiss",function(t){t.preventDefault();let o={};o._wpnonce=e(this).data("nonce");let i=e(this).data("action");wp.ajax.post(i,o).always(function(t){var o=e(".license-notice");o.fadeTo(100,0,function(){o.slideUp(100,function(){o.remove()})})})}),e(document).on("click",".wpc-upload",function(t){t.preventDefault();let o=e(this),i=o.next().next().val(),c=wp.media({title:"Insert image",library:{type:"image"},button:{text:"Use this image"},multiple:!1}).on("select",function(){let e=c.state().get("selection").first().toJSON();o.removeClass("button").html('<img src="'+e.url+'">'),o.next().show(),o.next().next().val(e.id)});c.on("open",function(){if(i){let e=c.state().get("selection"),t=wp.media.attachment(i);t.fetch(),e.add(t?[t]:[])}}),c.open()}),e(document).on("click",".wpc-remove",function(o){t(e(this))}),e(document).ajaxSuccess(function(o,i,c){"add-tag"===new URLSearchParams(c.data).get("action")&&(e("#wpc_term_img, #wpc_term_color").val(""),e(".wpc-remove").hide(),t(e("a.wpc-remove")),e(".wpc-color-picker .wp-picker-clear").trigger("click"))})}),e(document).on("click",".wpc-error.is-dismissible > .notice-dismiss",function(t){t.preventDefault();let o=e(this),i=o.parent(".wpc-error");i.fadeTo(100,0,function(){i.slideUp(100,function(){i.remove()})}),i.append(o)})}(jQuery);